package com.example.kingdee.KingdeeCreate;

import com.example.kingdee.KingdeeCreate.dto.CreateInDto;
import com.example.kingdee.KingdeeCreate.impl.CreateAllotBillImpl;
import com.example.kingdee.KingdeeCreate.impl.CreateProBillChainImpl;
import com.example.kingdee.KingdeeCreate.impl.CreateProBillImpl;
import com.example.kingdee.exception.ProcedureException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CreateBillFactory {

    @Autowired
    private CreateProBillImpl createProBill;

    @Autowired
    private CreateAllotBillImpl createAllotBill;
    @Autowired
    private CreateProBillChainImpl createProBillChain;

    public CreateBill createObject(CreateInDto createInDto){
        switch (createInDto.getBillType()){
            case "生产订单" : {
                return createProBill;
            }
            case "直接调拨" : {
                return createAllotBill;
            }
            case "生产入库" : {
                return createProBillChain;
            }
            default: throw new ProcedureException("请传入正确的单据类型", createInDto);
        }
    }
}
